/*****************************************************************************************
 * FILE NAME: drv_spi                       COPYRIGHT (c) cos 2024
 * REVISION:  1.0.0                                     All Rights Reserved
 * DESCRIPTION:
 * =======================================================================================
 * UPDATE HISTORY:
 * REV      AUTHOR      DATE
 * v1.0.0   Tuxin       2024.10.14
 * DESCRIPTION OF CHANGE:
 ****************************************************************************************/
#ifndef __DRV_SPI_H
#define __DRV_SPI_H

//----------------------------------------------------------------------------------------
// @Project Includes
#include "typedefs.h"

//----------------------------------------------------------------------------------------
// @Global Macro Define in the module
#define SPI                				SPI1
#define SPI_CLK            				RCC_APB2_PERIPH_SPI1

#define SPI_SCK_PIN        				GPIO_PIN_3 
#define SPI_SCK_PORT  						GPIOB  
#define SPI_SCK_GPIO_CLK   				RCC_APB2_PERIPH_GPIOA

#define SPI_MISO_PIN       				GPIO_PIN_4 
#define SPI_MISO_PORT 						GPIOB  
#define SPI_MISO_GPIO_CLK   			RCC_APB2_PERIPH_GPIOA

#define SPI_MOSI_PIN       				GPIO_PIN_5 
#define SPI_MOSI_PORT 						GPIOB
#define SPI_MOSI_GPIO_CLK   			RCC_APB2_PERIPH_GPIOA

#define SPI_CS_PIN             		GPIO_PIN_6 
#define SPI_CS_PORT       				GPIOB
#define SPI_CS_GPIO_CLK   				RCC_APB2_PERIPH_GPIOA

#define SPI_CS_LOW() 							GPIO_ResetBits(SPI_CS_PORT, SPI_CS_PIN)
#define SPI_CS_HIGH() 						GPIO_SetBits(SPI_CS_PORT, SPI_CS_PIN)

//----------------------------------------------------------------------------------------
// @Global Type defines in the module

//----------------------------------------------------------------------------------------
// @Export global Variables declare in the module

//----------------------------------------------------------------------------------------
// @Export declaration of functions in the module
void drv_spi_sleep(void);
void drv_spi_wakeup(void);
void drv_spi_init(void);

bool_t drv_spi_transmit(uint8_t *WriteData,uint8_t *ReadData,uint16_t NumByteToWrite);

//bool_t drv_i2c_write(uint8_t uDeviceAddr, uint8_t uCellAddr, uint8_t * puBuf, uint8_t uNum);
//bool_t drv_i2c_read(uint8_t uDeviceAddr, uint8_t uCellAddr, uint8_t * puBuf, uint8_t uNum);
//bool_t drv_i2c_readSh367306(uint8_t uDeviceAddr, uint8_t uCellAddr, uint16_t * puBuf);
//bool_t drv_i2c_dvcTransferData(uint8_t *writeData, uint16_t writeLen, uint8_t *readData, uint16_t readLen);

#endif

// =======================================================================================
// End of file.
// =======================================================================================
